﻿<UserControl 
    x:Class="FU.Capstones.IMS.Web.Silverlight.Controls.AddListControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Controls1="clr-namespace:FU.Capstones.IMS.Web.Silverlight.Controls" 
    xmlns:Controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
    xmlns:Common="clr-namespace:FU.Capstones.IMS.Web.Common;assembly=FU.Capstones.IMS.Web.Common"
    xmlns:Controls2="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Data">

    <UserControl.Resources>
        <Common:DataContextProxy x:Key="DataContextProxy"/>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        
        <TextBlock 
            Grid.Row="0" Grid.Column="1"
            Style="{StaticResource TextBlockNormalStyle}"
            Text="Tên/Mã vật liệu"
            />
        
        <TextBox 
            Grid.Row="0" Grid.Column="2"
            Style="{StaticResource TextBoxNormalStyle}"
            />
        
        <Controls1:SearchButtonControl 
            Grid.Row="0" Grid.Column="3"
            />

        <Controls:RadGridView
            Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3"
            telerik:StyleManager.Theme="Office_Black"
            Style="{StaticResource RadGridViewNormal}"
            ItemsSource="{Binding Path=MaterialCollection}"
            >
            <Controls:RadGridView.Columns>
                
                <Controls:GridViewColumn
                    IsSortable="True"
                    Header="Chọn">
                    <Controls:GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <CheckBox
                                HorizontalAlignment="Center"
                                IsChecked="{Binding Path=IsSelected, Mode=TwoWay}"
                                Command="{Binding Path=DataSource.SelectCommand, Source={StaticResource DataContextProxy}}"
                                CommandParameter="{Binding Path=AuthorizationID}"
                            />
                        </DataTemplate>
                    </Controls:GridViewColumn.CellTemplate>
                </Controls:GridViewColumn>
                
                <Controls:GridViewDataColumn 
                    Header="{StaticResource MaterialCodeLabelText}" 
                    DataMemberBinding="{Binding Path=MaterialCode}"
                    />

                <Controls:GridViewDataColumn 
                    Header="{StaticResource MaterialNameLabelText}" 
                    DataMemberBinding="{Binding Path=MaterialName}"
                    />
                
            </Controls:RadGridView.Columns>
            
            
        </Controls:RadGridView>

        <StackPanel
            Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3"
            Orientation="Horizontal">
            
            <telerik:RadButton
                Style="{StaticResource TRadButtonNormalStyle}"
                Content="Chọn tất cả"
                Command="{Binding Path=SelectAllCommand}"
                />

            <telerik:RadButton
                Style="{StaticResource TRadButtonNormalStyle}"
                Content="Bỏ chọn tất cả"
                Command="{Binding Path=UnselectAllCommand}"
                />

            <Controls2:RadDataPager 
                Style="{StaticResource DataPagerNormalStyle}"
                Source="{Binding Path=MaterialCollection}"
                />
        </StackPanel>

    </Grid>
</UserControl>
